/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.cs.volume.Volume;
/*    */ import com.zimbra.cs.volume.VolumeManager;
/*    */ import com.zimbra.soap.JaxbUtil;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import com.zimbra.soap.admin.message.GetCurrentVolumesRequest;
/*    */ import com.zimbra.soap.admin.message.GetCurrentVolumesResponse;
/*    */ import com.zimbra.soap.admin.message.GetCurrentVolumesResponse.CurrentVolumeInfo;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public final class GetCurrentVolumes
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element req, Map<String, Object> ctx)
/*    */     throws ServiceException
/*    */   {
/* 39 */     ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
/* 40 */     return zsc.jaxbToElement(handle((GetCurrentVolumesRequest)JaxbUtil.elementToJaxb(req), ctx));
/*    */   }
/*    */   
/*    */   private GetCurrentVolumesResponse handle(GetCurrentVolumesRequest req, Map<String, Object> ctx) throws ServiceException
/*    */   {
/* 45 */     ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
/* 46 */     checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Rights.Admin.R_manageVolume);
/*    */     
/* 48 */     GetCurrentVolumesResponse resp = new GetCurrentVolumesResponse();
/* 49 */     VolumeManager mgr = VolumeManager.getInstance();
/* 50 */     Volume msgVol = mgr.getCurrentMessageVolume();
/* 51 */     if (msgVol != null) {
/* 52 */       resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(msgVol.getId(), msgVol.getType()));
/*    */     }
/* 54 */     Volume secondaryMsgVol = mgr.getCurrentSecondaryMessageVolume();
/* 55 */     if (secondaryMsgVol != null) {
/* 56 */       resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(secondaryMsgVol.getId(), secondaryMsgVol.getType()));
/*    */     }
/*    */     
/* 59 */     Volume indexVol = mgr.getCurrentIndexVolume();
/* 60 */     if (indexVol != null) {
/* 61 */       resp.addVolume(new GetCurrentVolumesResponse.CurrentVolumeInfo(indexVol.getId(), indexVol.getType()));
/*    */     }
/* 63 */     return resp;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 68 */     relatedRights.add(Rights.Admin.R_manageVolume);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/GetCurrentVolumes.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */